Skip to content

fix(linux): fix KDE hotkey not registering at startup#498

Closed
xAlcahest wants to merge 2 commits into
OpenWhispr:mainfrom
xAlcahest:fix/kde-hotkey-startup
Closed

fix(linux): fix KDE hotkey not registering at startup#498
xAlcahest wants to merge 2 commits into
OpenWhispr:mainfrom
xAlcahest:fix/kde-hotkey-startup

Conversation

@xAlcahest

Copy link
Copy Markdown
Collaborator

Summary

Based on c6d3cf8 from #495.

On KDE Wayland with Electron 39, the hotkey didn't work until you manually re-set it in settings. KGlobalAccel D-Bus silently accepted the registration but never fired the shortcut signal.

The fix forces XWayland on KDE (where globalShortcut works via X11) and loads the saved hotkey from the userData .env early enough to register it before the page finishes loading.

What changed:

  • main.js: self-relaunch with --ozone-platform=x11 on KDE Wayland, plus early load of userData .env so DICTATION_KEY is available at hotkey init time
  • hotkeyManager.js: skip KGlobalAccel D-Bus path when running on XWayland, register hotkey directly from env var instead of waiting for did-finish-load (which never fired)
  • kdeShortcut.js: use flag 0 in setShortcut to always overwrite stale KGlobalAccel state
  • clipboard.js: longer restore delay on KDE Wayland (600ms) to handle the slow X11-to-Wayland clipboard bridge
  • run-electron.js: inject --ozone-platform=x11 before the app path in dev mode, so concurrently doesn't get killed by the self-relaunch
  • tsconfig.json: add typeRoots and types to fix phantom type errors

DamianPala and others added 2 commits March 24, 2026 17:19
On Electron 39+, appendSwitch("ozone-platform-hint", "x11") has no
effect — the ozone platform is selected during Chromium init, before
any JS runs. This causes the app to silently start on native Wayland
on KDE, breaking overlay positioning, focus, and always-on-top.

Self-relaunch with --ozone-platform=x11 before require("electron")
is the only way to get the flag onto the native command line in time.
Force XWayland on KDE via self-relaunch, load userData .env early
for DICTATION_KEY, skip KGlobalAccel D-Bus on XWayland and register
hotkey from env var before page load. Increase clipboard restore
delay for KDE Wayland clipboard bridge.
@gabrielste1n

Copy link
Copy Markdown
Collaborator

Closing — all fixes from this PR have been superseded by the work in #451 (feat/agent-tool-calling), which includes:

  • XWayland self-relaunch guard (extended to cover GNOME/Ubuntu/Unity in addition to KDE)
  • Early userData .env loading for DICTATION_KEY
  • Skip KGlobalAccel D-Bus path when running on XWayland
  • Register hotkey directly from env var instead of waiting for page load
  • kdeShortcut.js flag 0 to overwrite stale KGlobalAccel state
  • 600ms clipboard restore delay for KDE Wayland
  • run-electron.js XWayland injection for dev mode (KDE + GNOME)

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants